#include "mymusic.h"
#include "ui_mymusic.h"

MyMusic::MyMusic(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::MyMusic)
{
    ui->setupUi(this);
    initUi();
}

MyMusic::~MyMusic()
{
    delete ui;
}

void MyMusic::initUi()
{
    this->setWindowFlag(Qt::FramelessWindowHint);//设置Widget为无边界

    //设置背景透明化，阴影效果更加明显
    setAttribute(Qt::WA_TranslucentBackground);

    QGraphicsDropShadowEffect* shadoweffect=new QGraphicsDropShadowEffect(this);//设置窗口阴影
    shadoweffect->setOffset(0,0);
    shadoweffect->setColor("#000000");
    shadoweffect->setBlurRadius(30);
    this->setGraphicsEffect(shadoweffect);
    qDebug()<<"完成";
}


void MyMusic::on_close_clicked()//关闭按钮
{
    this->close();
}

void MyMusic::mouseMoveEvent(QMouseEvent *event)
{
    if(Qt::LeftButton==event->buttons())
    {
        move(event->globalPos()-dragPosition);
        return;
    }
    QWidget::mouseMoveEvent(event);//若非子类需要，交给父类处理
}

void MyMusic::mousePressEvent(QMouseEvent *event)
{
    if(Qt::LeftButton==event->buttons())
    {
        dragPosition=event->globalPos()-geometry().topLeft();
        return;
    }
    QWidget::mousePressEvent(event);//若非子类需要，交给父类处理
}



